package 笔试记录.M9day11信锐;

import java.util.Scanner;

public class 删除相同字符 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String myStr = sc.nextLine();

        int count = 1;//计数器，统计当前相同字符数量
        for (int i = 1; i < myStr.length(); i++) {
            if(myStr.charAt(i) == myStr.charAt(i - 1)){
                count++;
                //排除一下特殊情况
                if(count >= 3 && i == myStr.length() - 1){
                    myStr = myStr.substring(0,i - 2);
                    count = 0;
                    i = 0;
                }
                continue;
            }
            if(count >= 3) {
                myStr = myStr.substring(0, i - count) + myStr.substring(i);
                i = 0;
            }
            count = 1;
        }
        System.out.println(myStr);
    }
}
